<include file="Common:iframe_header"/>

<div id="container">
    <button event="add" class="layui-btn layui-btn-small">
        <i class="layui-icon">&#xe608;</i> 添加
    </button>
    <table id="listTable" class="site-table table-hover" style="table-layout:fixed;">
        <thead>
        <tr>
            <th>权限名称</th>
            <th>控制器\方法（顶级菜单填写别称）</th>
            <th>创建时间</th>
            <th>操作</th>
        </tr>
        </thead>
        <tbody>
        <volist name="ruleList" id="rule">
            <if condition="($rule['pid'] eq 0) AND ($rule['children'] eq 0)">
                <tr key={$key} event="{$rule.pid}" class="leaf {$rule.pid}">
                    <td>
                        <elseif condition="($rule['pid'] neq 0) AND ($rule['children'] eq 0)"/>
                <tr key={$key} event="{$rule.pid}" class="leaf {$rule.pid}">
                    <td>
                        <for start="1" end="$rule.speed">
                            <span class="text-indent"></span>
                        </for>
                        <span class="switch"></span>
                        <elseif condition="($rule['pid'] eq 0) AND ($rule['children'] neq 0)"/>
                <tr key={$key} event="{$rule.pid}" class="outer {$rule.pid}">
                    <td>
                        <for start="1" end="$rule.speed">
                            <span class="text-indent"></span>
                        </for>
                        <!--<span class="switch"></span>-->
                        <else/>
                <tr key={$key} event="{$rule.pid}" class="outer {$rule.pid}">
                    <td>
                        <for start="1" end="$rule.speed">
                            <span class="text-indent"></span>
                        </for>
                        <!--<span class="switch"></span>-->
            </if>
            <!--<span class="ico"></span>-->
            <span class="name">{$rule.title}</span>
            </td>
            <input type="hidden" name="id" value="{$rule.id}"/>
            <td>{$rule.name}</td>
            <td>{$rule.create_time|date="Y-m-d H:i:s",###}</td>
            <td>
                <if condition="$rule.speed lt 3">
                    <button event="add" class="layui-btn layui-btn-mini layui-btn-warm">添加子节点</button>
                    <else/><button event="add" disabled class="layui-btn layui-btn-mini layui-btn-disabled">添加子节点</button>
                </if>
                <button event="edit" class="layui-btn layui-btn-mini">编辑</button>
                <button event="del" class="layui-btn layui-btn-mini layui-btn-danger">删除</button>
            </td>
            </tr>
        </volist>
        </tbody>
    </table>
</div>

<include file="rulesAdd"/>
<include file="rulesEdit"/>
<include file="rulesFormTpl"/>
<include file="rulesDrop"/>
<include file="Commin:iframe_footer"/>
<script>
    layui.use(['jquery'],function () {
        var $ = layui.jquery;
        $.dataSource = {};
        $.dataSource.navs = $.parseJSON('{:json_encode($ruleList)}');
    });
</script>